package net.zapasa.modelo.service;

import javax.annotation.Resource;

import net.zapasa.core.common.exception.BusinessException;
import net.zapasa.core.common.util.LogUtil;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("prototype")
public class PriceCompetitiveThread extends Thread {

	@Resource
	ParserPriceCompetitiveService parseService;

	@Override
	public void run() {

		LogUtil.info(this.getClass(), "Inicia el hilo {0}", this.getName());

		try {
			parseService.updateAll();
		} catch (BusinessException e) {
			LogUtil.error(this.getClass(), e,
					"No se han podido obtener los precios de la competencia en el hilo");
		} finally {
			LogUtil.info(this.getClass(), "Fin el hilo {0}", this.getName());
		}

	}
}
